package com.ss.demo.springbootdemo.controller;

import com.ss.demo.springbootdemo.ex.MyException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 作者: MrZhangJR
 * 时间: 2021/11/3 15:32
 * 描述:
 */
@RestController
@RequestMapping("/ex")
public class ExceptionTestController {

    @RequestMapping("/test1")
    public Object test1() {
        int a = 1/0;
        return "failed";
    }

    @RequestMapping("/test2")
    public Object test2() {
        if (true) {
            throw new MyException("用户名错误..");
        }
        return "failed";
    }
}
